<div id="tab-server">
	<button onclick="javascript:askServerInfo()" class="ui-button-text-icon">
		Refresh <img border="0" alt="Refresh" src="images/execute.png" align="top" />
	</button>
	<div id="tabs-server">
		<ul>
			<li><a href="#tab-server-intro"><span>Introduction</span> </a></li>
			<li><a href="#tab-server-conns"><span>Active Connections</span> </a></li>
			<li><a href="#tab-server-config"><span>Configuration</span> </a></li>
			<li><a href="#tab-server-dbs"><span>Database pool</span> </a></li>
			<li><a href="#tab-server-storages"><span>Used Storages</span> </a></li>
			<li><a href="#tab-server-profiler"><span>Profiler</span> </a></li>
		</ul>
		<div id="tab-server-intro">
			<p class="help">This is the section with the Server's information. To access it you have to provide the OrientDB Server's credentials. If you
				have access to the server look to the orientdb-server-config.xml file and search the XML user tag. Remember that the first time the Server is
				executed the 'root' user is created with a automatically generated password. Below and example:</p>
			<p class="code">
				&lt;users&gt;<br /> &nbsp;&nbsp;&lt;user&gt; name="root" password="FAFF343DD54DKFJFKDA95F05A033A6A59E2F57CDF35058E4D4AF7AE12910B508384C47"
				resources="*" /&gt;<br /> &lt;/users&gt;
			</p>
		</div>
		<div id="tab-server-conns">
			<table style="width: 100%;">
				<tr>
					<td valign="top" class="help">Below all the active connections. Keep in mind that HTTP connections are stateless, so no database is retained
						and usually after a short timeout (seconds) they are killed. Binary connections, instead, remain in life until the connection client closes it.
						Binary connections are used by the <a href="http://code.google.com/p/orient/wiki/ConsoleCommands">Orient Console</a> tool and by any Orient Java
						applications that uses the native <a href="http://code.google.com/p/orient/wiki/JavaAPI">Java API</a>.
					</td>
				</tr>
				<tr>
					<td valign="top">
						<table id="serverConnections" style="width: 100%;" cellspacing="0" cellpadding="5" border="1">
						</table>
					</td>
				</tr>
			</table>
		</div>
		<div id="tab-server-config">
			<table style="width: 100%;">
				<tr>
					<td valign="top">
						<table id="serverConfigProperties" style="width: 100%;" cellspacing="0" cellpadding="5" border="1">
						</table>
					</td>
				</tr>
			</table>
		</div>
		<div id="tab-server-dbs">
			<table style="width: 100%;">
				<tr>
					<td valign="top">
						<table id="serverDbs" style="width: 100%;" cellspacing="0" cellpadding="5" border="1">
						</table>
					</td>
				</tr>
			</table>
		</div>
		<div id="tab-server-storages">
			<table style="width: 100%;">
				<tr>
					<td valign="top">
						<table id="serverStorages" style="width: 100%;" cellspacing="0" cellpadding="5" border="1">
						</table>
					</td>
				</tr>
			</table>
		</div>
		<div id="tab-server-profiler">
			<table style="width: 100%;">
				<tr>
					<td valign="top"><b>Hook Values</b>
						<table id="serverProfilerHooks" style="width: 100%;" cellspacing="0" cellpadding="5" border="1">
						</table></td>
				</tr>
				<tr>
					<td valign="top"><b>Counters</b>
						<table id="serverProfilerCounters" style="width: 100%;" cellspacing="0" cellpadding="5" border="1">
						</table></td>
				</tr>
				<tr>
					<td valign="top"><b>Statistics</b>
						<table id="serverProfilerStats" style="width: 100%;" cellspacing="0" cellpadding="5" border="1">
						</table></td>
				</tr>
				<tr>
					<td valign="top"><b>Chronos</b>
						<table id="serverProfilerChronos" style="width: 100%;" cellspacing="0" cellpadding="5" border="1">
						</table></td>
				</tr>
			</table>
		</div>
	</div>
</div>

<script language="javascript">
	$('#tabs-server').tabs();

	function askServerInfo() {
		serverInfo = orientServer.serverInfo();
		if (serverInfo == null) {
			jQuery("#output").val(orientServer.getErrorMessage());
		} else {
			writeServerInfo(serverInfo);
		}
	}

	function writeServerInfo(server) {
		fillStaticTable($('#serverConnections'),
				[ 'Connection Id', 'Remote Client', 'Database', 'Protocol',
						'Protocol V.', 'Driver Name', 'Driver V.', 'Client Id',
						'User', 'Total requests', 'Command info',
						'Command detail', 'Last command On',
						'Last command info', 'Last command detail',
						'Last execution time', 'Total working time',
						'Connected since' ], server['connections']);
		fillStaticTable($('#serverDbs'), [ 'Database', 'User', 'Status',
				'Storage' ], server['dbs']);
		fillStaticTable($('#serverStorages'), [ 'Name', 'Type', 'Path',
				'Active users' ], server['storages']);
		fillStaticTable($('#serverConfigProperties'), [ 'Name', 'Value' ],
				server['properties']);

		fillStaticTable($('#serverProfilerHooks'), [ 'Name', 'Value' ],
				server['profiler']['hookValues']);
		fillStaticTable($('#serverProfilerCounters'), [ 'Name', 'Value' ],
				server['profiler']['counters']);
		fillStaticTable($('#serverProfilerStats'), [ 'Name', 'Total',
				'Average Elapsed (ms)', 'Min Elapsed (ms)', 'Max Elapsed (ms)',
				'Last Elapsed (ms)', 'Total Elapsed (ms)' ],
				server['profiler']['stats']);
		fillStaticTable($('#serverProfilerChronos'), [ 'Name', 'Total',
				'Average Elapsed (ms)', 'Min Elapsed (ms)', 'Max Elapsed (ms)',
				'Last Elapsed (ms)', 'Total Elapsed (ms)' ],
				server['profiler']['chronos']);
	}
</script>